<?php

/**
 * Image form.
 *
 * @package    vogue
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ImageForm extends BaseImageForm
{
  public function configure()
  {
      unset($this['id'],$this['created_at']);
      
      # WIDGETS
    	$types = myConstants::getGalleryTypes();
    	$this->widgetSchema['album_id']    = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Album'), 'add_empty' => false));
      $this->widgetSchema['filename']    = new sfWidgetFormInputFile(array(), array('style'=>'width:385px;'));
      $this->widgetSchema['description'] = new sfWidgetFormTextarea(array(), array('style'=>'width:385px;'));
      $this->widgetSchema['is_cover']    = new sfWidgetFormInputCheckbox(array(), array('value'=>1));
      
      $this->setDefault('album_id', $this->getOption('albumId'));
      
      
      # VALIDATORS
      $this->validatorSchema['album_id']    = new sfValidatorPass();
    	$this->validatorSchema['description'] = new sfValidatorPass();
    	$this->validatorSchema['is_cover']    = new sfValidatorPass();
      $this->validatorSchema['filename']    = new sfValidatorFile(
                                                  array('required' => false,
                                                      'path'       => sfConfig::get("sf_upload_dir")."/gallery",
                                                      'max_size'   => 209715200,
                                                      'mime_types' =>  array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif',)),
                                                  array(
                                                      'max_size'   => 'Файлын хэмжээ хамгийн ихдээ 20MB байна',
                                                      'mime_types' => 'Дараах өргөтгөлтэй файлууд зөвшөөрөгдөнө: jpg, png, gif'));

      $this->widgetSchema->setHelp('filename', 'png | gif | jpg');
      
      
      // LABELS      
      $this->widgetSchema->setLabel('album_id', 'Цомог *');
      $this->widgetSchema->setLabel('filename', 'Зураг *');
      $this->widgetSchema->setLabel('description', 'Тайлбар');
      $this->widgetSchema->setLabel('is_cover', 'Цомгийн нүүр зураг болгох');
  }

}